﻿$(function () {
    
    var $currentTableBar = $("#currentTableBar");
    $currentTableBar.html(getexhtml($currentTableBar));

    var $toolbarDemo = $("#toolbarDemo");
    $toolbarDemo.html('<div class="layui-btn-container">' + getexhtml($toolbarDemo) + '</div>');


    var $authstate = $("#auth-state");
    $authstate.html(getexhtml($authstate));

    var $exbtn = $("#ex_btn");    
    $exbtn.html(getexhtml($exbtn));
});

//listButton_Code 在layout
function getexhtml($toolbarDemo) {

    var html = $toolbarDemo.html();
    if (!html) { return; }

    var pattern = /<.*>/g;
    var r = html.match(pattern);
    var arrbutton = listButton_Code.split(',');
    var newstr = "";
    for (var i = 0; i < r.length; i++) {
        //var id = r[i].match(/ex_btn=\"\w+?\"/g);
        var id = r[i].match(/ex_btn=\"[\w]*\"/g);
        var c = 0;
        for (var j = 0; j < arrbutton.length; j++) {
            if ("ex_btn=\"" + arrbutton[j] + "\"" == id) {
                newstr += r[i];
                break;
            }
        }
    }
    return newstr;
}
